package com.example.pojo;

import com.example.util.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Book {
    private Integer id;
    private String bookName;
    private String author;
    private String description;
    private Integer number;
    private Double price;
    /* Date格式 */
    private Date published;
    /* 字符串格式 */
    private String publishedDate;
    private Integer isActive;

    /* mybatis映射published字段时调的方法 */
    public void setPublished(Date published) {
        this.published = published;
        setPublishedDate(DateUtil.formatDate(published));
    }
}
